package display;

import java.io.IOException;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import display.rougehack.RH_MapDisplay;
import enviro.*;

@SuppressWarnings("serial")
public class MainFrame extends JFrame{

    // <editor-fold defaultstate="collapsed" desc="Member Variables">
	private RH_MapDisplay mapDisplay = new RH_MapDisplay();
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Constructor(s)">
	/** 
	 * Constructor
	 * 
	 * This constructor sets up the main frame for display, 
	 * establishes and configures the layout.
	 */
	public MainFrame() {
		
		// Condition frame for sizing in OS
		setSize(800,600);
		setTitle("RogueHack");
		setLocationRelativeTo(null);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		// Condition frame layout
		setLayout(new BorderLayout());
		
	    // Add initial frame components
		add(mapDisplay, BorderLayout.CENTER);
		
		// Turn on the frame.
		setVisible(true);
	}
        // </editor-fold>
	
    // <editor-fold defaultstate="collapsed" desc="API">
        
	/**
	 * Load Dungeon
	 * 
	 * This method loads the new dungeon and all relevant aspects of it
	 * into the UI
	 *
	 * @param dungeon
	 *   This is the new dungeon to be loaded onto the screen.
	 */
	public void loadDungeon(Dungeon dungeon) throws IOException {
		mapDisplay.loadDungeon(dungeon);
	}
	
	/**
	 * Show Map Display
	 * 
	 * This method will activate or deactivate the map display on the main
	 * window.
	 * 
	 * @param show
	 *   TRUE == Show Map
	 *   FALSE == Hide Map
	 */
	public void showMapDisplay(boolean show) {
		mapDisplay.setVisible(show);
	}

    // </editor-fold>
}
